# -*- coding: utf-8 -*-
# @Time    : 2020/6/30 上午10:14
# @Author  : lilong

"""
参考：https://blog.csdn.net/qq_27011361/article/details/90171855
"""

from mitie import *

print("loading Total Word Feature Extractor...")
twfe = total_word_feature_extractor('tmp_test/total_word_feature_extractor.dat')

# 获取特征字典的指纹
print("Fingerprint of feature dictionary:", twfe.fingerprint)
print()

# 获取特征向量的维数
print("Number of dimensions of feature vectors:", twfe.num_dimensions)
print()

# 获取字典中的单词数
print("Number of words in the dictionary:", twfe.num_words_in_dictionary)
print()

# 获取字典中的单词列表
words = twfe.get_words_in_dictionary()
print("First 10 words in dictionary:", words[0:200])
print()

# 获取一个单词的特征
feats = twfe.get_feature_vector("我")
print("First 5 features of word 'home'", feats[0:])

# 总的单词特征提取器还将为不在其词典中的单词（未登陆词）生成特征向量。 它通过查看单词形态来做到这一点。
feats = twfe.get_feature_vector("_word_not_in_dictionary_")
print("First 5 features of word '_word_not_in_dictionary_'", feats[0:50])
